/****** Object:  Stored Procedure [dbo].spChiTietBienBanKiemKeKhoSelectAllByMaBBKKK Script Date: 7/16/2012 ******/
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = object_id(N'[dbo].[spChiTietBienBanKiemKeKhoSelectAllByMaBBKKK]') AND OBJECTPROPERTY(id, N'IsProcedure') = 1)
	DROP PROCEDURE [dbo].[spChiTietBienBanKiemKeKhoSelectAllByMaBBKKK]
GO

/******************************************************************************
**		Change History
*******************************************************************************
**		Date:		Author:					Description:
**		--------	--------				-----------------------------------
**		17/07/2012	SongTM					Innit created
*******************************************************************************/

CREATE PROCEDURE [dbo].[spChiTietBienBanKiemKeKhoSelectAllByMaBBKKK]
(
	@MaBBKKK nvarchar(12)
)
WITH ENCRYPTION

AS

SET NOCOUNT ON

SELECT
	[tbl_ChiTietBienBanKiemKeKho].*,
	tbl_SanPham.*,
	tbl_LuuKho.*,
	tbl_LuuKho.MaThuoc
FROM [tbl_ChiTietBienBanKiemKeKho] INNER JOIN tbl_LuuKho ON tbl_LuuKho.maLuuKho=[tbl_ChiTietBienBanKiemKeKho].MaLuuKho
	INNER JOIN tbl_SanPham ON tbl_SanPham.MaThuoc = tbl_LuuKho.MaThuoc

WHERE [MaBBKKK] = @MaBBKKK
GO

--GRANT EXECUTE ON [dbo].[spChiTietBienBanKiemKeKhoSelectAllByMaBBKKK] TO [sa]
--GO
